Repository navigation
perf(spdk): replace sector division with cached shifts - #30
Merged
thweetkomputer merged 1 commit intoNov 3, 2026
Merged
Conversation
Cache the exponent after validating a power-of-two sector size. Use masks for alignment and shifts for synchronous and asynchronous LBA conversion, retaining existing range and result-size checks. Validated 130 bypass-capable tests, including new 1/512/4096-byte sector cases, queued conversions, exact device-end requests, malformed sector sizes and overflow rejection. GCC 13 AArch64 O3 assembly removes both variable divisions from the inspected submission functions.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPDK submission currently uses variable division and remainder for sector alignment and LBA conversion even though device discovery already accepts only nonzero power-of-two sector sizes. Cache the sector exponent during discovery, then use a mask for alignment and shifts for LBA/count conversion in synchronous metadata I/O and asynchronous worker I/O.
Existing device validation, request-size limits, overflow-safe range checks, queue ordering and completion semantics remain unchanged. Seven new stub cases cover synchronous/asynchronous conversion with 1-, 512- and 4096-byte sectors, malformed sector sizes, queued requests, offsets beyond 32 bits, exact device-end requests, misalignment and overflow rejection.
Validation from the Bycorf repository:
The existing build uses
CMAKE_BUILD_TYPE=Debug,BYCORF_BUILD_EXAMPLES=OFFandBYCORF_KERNEL_BYPASS=ON. All 130 tests passed. Formatting and whitespace checks passed.GCC 13.3/AArch64
-O3assembly has zero variable divisions in the inspected synchronous submission and four asynchronous read/write entry points, versus two per function before. The synchronous whole-function instruction count stays 152; asynchronous read/read-fixed counts fall from 84 to 83 and write/write-fixed from 85 to 84. This is static code-generation evidence, not a hardware throughput or latency measurement.